All Questions
Tagged with arrayobject-oriented
67 questions
3votes
1answer
91views
Merge discrete integer intervals
What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
1vote
1answer
140views
Transform an array into object and set index for an unique key in javascript
I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
2votes
1answer
389views
Generating random number of randomly sized Squares/Rectangles using numpy arrays
I made classes to use in generating square/rectangular shapes on a texture. ...
1vote
1answer
418views
Best way to cherry pick objects from array of objects
With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
2votes
2answers
125views
Complex Filter in one Opration
I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
2votes
0answers
54views
editing the array I've included instead of editing the file of included array php
In order to reduce time complexity, instead of loading (and then dumping to use it for later) the whole file into an array (It would be O(n) with n=number of lines), I have saved it as array into a ...
6votes
2answers
503views
Usage of Factory pattern for maintaing bookshelf having books, magazine and notes
I have tried to achieve the following task using Factory Pattern with PHP version 7.0. Define the classes and their methods (including parameters and return types) for a system that consist of a ...
2votes
2answers
47views
Combine data from array of objects
I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new ...
1vote
2answers
767views
Recursively find data in array of objects
On this script I look up properties in an array of objects. There is an original array of strings list to get the objects that match the ...
1vote
1answer
4kviews
Add / Overwrite an object in an array
I am trying to overwrite an object in an array if the title property exists, otherwise just push it to the array. I found two approaches and I wonder which one is ...
6votes
1answer
357views
JavaScript: A drawing program in OOP
I made a little drawing program in OOP. The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each ...
1vote
1answer
105views
JavaScript, looping, and functional approach
Data Structure coming back from the server ...
5votes
1answer
12kviews
React hooks update array of object
I have declared a react hook which will contain an array of object as follows: const [rowDataTracker, setRowDataTracker] = useState([]); Now I need to update the ...
3votes
1answer
55views
Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition
Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
2votes
2answers
315views
Console dice game
I wrote a simple dice game with the purpose to practice arrays and classes. I would like some critique on my code structure and quality - as well as thoughts on my thoughts to improve it. Here's the ...